//-----------------------------------------------------------------------
// <copyright file="IDSSortService.cs" company="Pyramid Consulting">
//     Copyright (c) Pyramid Consulting. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using MyFramework;
using MIMS.WRS.Entities;
using MIMS.WRS.Data;
    
namespace MIMS.WRS.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class IDSSortService
    {
		public static IDSSortCollection GetIDSSortsOnIDS()
		{            
			try
			{
				IDSSortDAO iDSSortDAO = new IDSSortDAO();
				return iDSSortDAO.GetIDSSortsOnIDS();
			}
			catch (BusinessException)
			{
				throw;
			}
			catch (Exception ex)
			{
				// log this exception
				Logger.Error(ex);
				// wrap it and rethrow
				throw new BusinessException(SR.BusinessGetIDSSortsException, ex);
			}
		}

        #region IDSSort

        public static void CreateIDSSort(IDSSort iDSSort)
        {            
            try
            {
                IDSSortDAO iDSSortDAO = new IDSSortDAO();
                iDSSortDAO.CreateIDSSort(iDSSort);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessCreateIDSSortException, ex);
            }
        }        

        public static void UpdateIDSSort(IDSSort iDSSort)
        {            
            try
            {
                IDSSortDAO iDSSortDAO = new IDSSortDAO();
                iDSSortDAO.UpdateIDSSort(iDSSort);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessUpdateIDSSortException, ex);
            }
        }        

        public static void DeleteIDSSort(int iDSSortID)
        {            
            try
            {
                IDSSortDAO iDSSortDAO = new IDSSortDAO();
                iDSSortDAO.DeleteIDSSort(iDSSortID);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeleteIDSSortException, ex);
            }
        }
        
        public static IDSSort GetIDSSort(int iDSSortID)
        {            
            try
            {
                IDSSortDAO iDSSortDAO = new IDSSortDAO();
                return iDSSortDAO.GetIDSSort(iDSSortID);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetIDSSortException, ex);
            }
        }                

        public static IDSSortCollection GetIDSSorts(IDSSortColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                IDSSortDAO iDSSortDAO = new IDSSortDAO();
                return iDSSortDAO.GetIDSSorts(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetIDSSortsException, ex);
            }
        }        

        public static IDSSortCollection GetIDSSorts(IDSSortColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                IDSSortDAO iDSSortDAO = new IDSSortDAO();
                return iDSSortDAO.GetIDSSorts(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetIDSSortsException, ex);
            }
        }        

        #endregion
    }
}